# Install and use the Tour

Tourist Guide into your React Components

## Install [@reactour/tour](https://www.npmjs.com/package/@reactour/tour)

```sh npm2yarn
npm i @reactour/tour
```

## Usage

import { Steps } from 'nextra/components'

<Steps>

### 1. Add the `TourProvider`

This should be at the root of your Application, passing the steps of the elements to highlight during the Tour.

```js
import { TourProvider } from '@reactour/tour'

ReactDOM.render(
  <TourProvider steps={steps}>
    <App />
  </TourProvider>,
  document.getElementById('root')
)

const steps = [
  {
    selector: '.first-step',
    content: 'This is my first Step',
  },
  // ...
]
```

### 2. Control the Tour

Then somewhere down the Application tree, control the Tour using `useTour` hook.

```js
import { useTour } from '@reactour/tour'

function App() {
  const { setIsOpen } = useTour()
  return (
    <>
      <p className="first-step">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent at
        finibus nulla, quis varius justo. Vestibulum lorem lorem, viverra porta
        metus nec, porta luctus orci
      </p>
      <button onClick={() => setIsOpen(true)}>Open Tour</button>
    </>
  )
}
```

</Steps>
